<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>修改密码</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

	<script type="text/javascript" src="js/jquery-1.8.3.js"></script>
  	<script type="text/javascript">
  	$(document).ready(function(){
  		$("#button").click(function(){
  		var user=$("#user").val();
  		var password1=$("#password1").val();
  		var password2=$("#password2").val();
  		var length=/^[0-9]{6}$/;
  		if(user == ""){
  			alert("用户名不能为空");
  		}else if(password1 == ""){
  			alert("密码不能为空");
  		}else if(!length.test(password1)){
  			alert("密码输入不符");
  		}else if(!(password2 == password1)){
  			alert("两次密码不符");
  		}else{
  			$.ajax({
  				url:"<%=path%>/user/updatepassword",
  				data:{
  					user:user,
  					password1:password1,
  					password2:password2
  				},
  				type:"post",
  				success:function(date){
  					if(date == 0){
  						alert("修改成功，点击确认跳转至登录页面");
  						window.location.href="login.jsp";
  					}else{
  						alert("用户名不存在");
  					}
  				}
  			});
  		}
  	});
});
  </script>
	
  </head>
  
  
  <body>
  <div align="center">
  <div style="padding-right: 1000px; border: 0xp solid red; height: 5%;" ><img src="images/eanquan.png">&nbsp;&nbsp;&nbsp;&nbsp;<font style="font-size: 20px;">找回密码</font></div>
  
  <div style="padding-right: 800px; padding-top:60px; border: 0xp solid red; background-color: DDDFDE;"><img src="images/001.png">请输入您要找回登录密码的用户名</div>
  <div style="height: 70%;background-color: DDDFDE;">
  
  		<div style="padding-right: 400px; background-color: DDDFDE;" >
  		<form action="<%=path%>/user/updatepassword" method="post">
  		<table  cellpadding="0" cellspacing="0" border="0" align="center" style="background-color: DDDFDE;">
  			<tr height="60px;"><td colspan="3"></td></tr>
  			<tr>
  				<td>&nbsp;&nbsp;</td>
  				<td style="width:100px; height: 40px;" align="left">用&nbsp;&nbsp;户&nbsp;名:</td>
  				<td><input type="text" name="user" id="user" value="" style="width: 300px; height: 40px; "/>&nbsp;&nbsp;</td>
  			</tr>
  			<tr height="30px;"><td colspan="3"></td></tr>
  			<tr>
  				<td></td>
  				<td style="width:100px; height: 40px;" align="left">输入密码:</td>
  				<td><input type="password" name="password1" id="password1" value="" style="width: 300px; height: 40px;"/>&nbsp;&nbsp;六位数字</td>
  			</tr>
  			<tr height="30px;"><td colspan="3"></td></tr>
  			<tr>
  				<td></td>
  				<td style="width:100px; height: 40px;" align="left">确认密码:</td>
  				<td><input type="password" name="password2" id="password2" value="" style="width: 300px; height: 40px;"/>&nbsp;&nbsp;六位数字</td>
  			</tr>
  			<tr height="30px;"><td colspan="3"></td></tr>
  			<tr>
  				<td colspan="3" align="center"><input type="button" id="button" value="确定"  style="width: 400px; height: 40px; color:white; background-color: red; font-size: 20px;"/></td>
  			</tr>
  			
  			<tr height="60px;"><td colspan="3" align="center" style="color: red;"><input type="hidden" value="${result}"></td></tr>
  		</table>
  	</form>	
  	</div>
  </div>
  <p style="height:15px;"></p>
  <p>咨询电话：0755-86133729　　公司地址：广东省深圳市龙华新区留仙大道24号彩悦大厦10楼</p>
  <p>&copy;   2013-2015深圳市万物联有限公司版权所有　　丨　　　粤ICP备13071979号-2</p>
  </div>
  </body>
</html>
